<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app" style="font-family: 'stxingkai';">
        你好
    </div>
    <template >
        <div>

        </div>
    </template>
    <script type="module">
        import Observer from "../Array/Observer.js";
        import Watcher from "../Array/Watcher.js";
        let vm = {
            data: {
                nameList: ["珠海市"],      
            },
            update(newV,oldV) {
                console.log("成功监听:",newV,oldV);
            }
        }
        new Observer(vm.data);
        new Watcher(vm,"data.nameList",vm);
        let name = ['林渊','林渊的爸爸','林渊的妈妈','林渊的女朋友','林渊的姐姐','林渊一家人'];
        
        // 可以被监听
        vm.data.nameList = [...vm.data.nameList,...name];
        // 没有被监听
        vm.data.nameList[0] = "你好啊";
        // 没有被监听
        vm.data.nameList.push("我来啦");
        const sleep = function(delay) {
            return new Promise(r=>{
                setTimeout(r,delay);
            })
        }

    </script>
</body>
</html>